///////////////////////////////////////////////////////////////////////////////
///
/// Cylan Client
/// Copyright (C) Shenzhen Cylan Tech. Co., Ltd. 2012
///
/// @file       syslog.h
/// @brief      syslog日志发送客户端API
///
///////////////////////////////////////////////////////////////////////////////
#ifndef SYSLOG_H
#define SYSLOG_H

#include <stdarg.h>

typedef enum SYSLOG_FACILITY
{
    syslog_facility_kern = 0,               /// kernel messages
    syslog_facility_user,                   /// user-level messages (default)
    syslog_facility_mail,                   /// mail system
    syslog_facility_daemon,                 /// system daemons
    syslog_facility_auth,                   /// security/authorization messages
    syslog_facility_syslogd,                /// messages generated internally by syslogd
    syslog_facility_lpr,                    /// line printer subsystem
    syslog_facility_news,                   /// network news sussystem
    syslog_facility_UUCP,                   /// UUCP subsystem
    syslog_facility_cron,                   /// clock daemon
    syslog_facility_authpri,                /// security/authorization messages
    syslog_facility_ftp,                    /// ftp daemon
    syslog_facility_local0,                 /// reserved for local use
    syslog_facility_local1,                 /// reserved for local use
    syslog_facility_local2,                 /// reserved for local use
    syslog_facility_local3,                 /// reserved for local use
    syslog_facility_local4,                 /// reserved for local use
    syslog_facility_local5,                 /// reserved for local use
    syslog_facility_local6,                 /// reserved for local use
    syslog_facility_local7,                 /// reserved for local use
} SYSLOG_FACILITY;

typedef enum SYSLOG_PRIORITY
{
    syslog_priority_emerg = 0,              /* system is unusable */
    syslog_priority_alert,                  /* action must be taken immediately */
    syslog_priority_crit,                   /* critical conditions */
    syslog_priority_err,                    /* error conditions */
    syslog_priority_warning,                /* warning conditions */
    syslog_priority_notice,                 /* normal but significant condition */
    syslog_priority_info,                   /* informational */
    syslog_priority_debug                   /* debug-level messages */
} SYSLOG_PRIORITY;

typedef enum SYSLOG_SERVER_TYPE_ENUM
{
    syslog_server_tcp = 0,
    syslog_server_udp
} SYSLOG_SERVER_TYPE_ENUM;

typedef struct SYSLOG_SERVER SYSLOG_SERVER;

#ifdef __cplusplus
extern "C"
{
#endif

int syslog_startup();
int syslog_cleanup();
int syslog_server_new(SYSLOG_SERVER **server, const char *addr, const char *serve, SYSLOG_SERVER_TYPE_ENUM type);
int syslog_server_free(SYSLOG_SERVER *server);
int syslog_vprintf(SYSLOG_SERVER *server, SYSLOG_FACILITY facility, SYSLOG_PRIORITY priority, const char *tag, int pid, const char *format, va_list ap);
int syslog_printf(SYSLOG_SERVER *server, SYSLOG_FACILITY facility, SYSLOG_PRIORITY priority, const char *tag, int pid, const char *format, ...);

#ifdef __cplusplus
};
#endif

#endif /* SYSLOG_H */

